package com.shire.shire_interface.constants;


import com.shire.shire_interface.common.utils.StrUtils;

import java.util.HashMap;
import java.util.Map;

public class WxErrorCode {

    // 初始值
    public static final int INIT_VALUE = -100;

    // 成功
    public static final int SUCCESS = 0;

    // 系统错误，一般为异常
    public static final int SYS_ERROR = 30000;

    ///////////////CRK使用
    // k参数不存在
    public static final int LOST_K = 30001;
    // n参数不存在
    public static final int LOST_N = 30002;
    // 设备未注册
    public static final int UNREG_DEVICE = 30003;
    // station不存在
    public static final int UNREG_STATION = 30004;
    // station未分配账号
    public static final int UNSET_ACCOUNT_FOR_STATION = 30005;
    // k1参数不存在
    public static final int LOST_K1 = 30005;
    // 参数非法
    public static final int INVALID_PARAMETER = 31000;
    // 微信账号未设置设备参数
    public static final int ACCOUNT_PARA_EMPTY = 31001;
    // 账号和station的设备参数不一致
    public static final int PARA_NOT_MATCHED = 31002;
    // 账号不存在
    public static final int ACCOUNT_NOT_EXISTS = 31003;
    // 基础群未设置
    public static final int BASE_GROUP_NOT_EXISTS = 31004;



    ///////////////指令系统使用
    public static final int CMD_TASK_NOT_EXISTS = 32000;
    public static final int CMD_TASK_NOT_RUNNING = 32001;
    public static final int CMD_TASK_TIMEOUT = 32002;
    public static final int CMD_TASK_OVER_DAY_LIMIT = 32003;
    public static final int CMD_TASK_OVER_HOUR_LIMIT = 32004;
    public static final int CMD_TIMEOUT = 32005;
    public static final int CMD_TRYTIMES_OVER = 32006;

    ///////////////后台使用
    public static final int TASK_NOT_EXISTS = 33000;

    // 群卡片超时
    public static final int GROUP_WAIT_EXPIRED = 34002;
    // 后台判断该群已添加
    public static final int GROUP_WAIT_JOINED = 34003;
    // 后台判断该群会频繁操作
    public static final int GROUP_WAIT_FREQUENTLY = 34004;
    // 后台判断包含敏感词
    public static final int GROUP_WAIT_SENSITIVE = 34005;

    ///////////////客服使用


    // 加群操作频繁
    public static final int GROUP_ADD_FREQUENT = 20001;
    // 加群过期
    public static final int GROUP_ADD_EXPIRED = 20002;
    // 加群，找不到好友
    public static final int GROUP_ADD_FRIEND_NOT_FOUND = 20017;

    // 邀请群需要群主验证
    public static final int GROUP_INVITE_NEED_VERIFY = 20023;


    public static Map<Integer, String> _err_title = new HashMap<Integer, String>(){{
        put(-101, "正常");
        put(-100, "初始值");
        put(0, "结果成功");
        // CRK
        put(10000, "端口号错误");
        put(10001, "指令错误");
        put(10002, "指令执行失败");
        put(10003, "截屏失败");
        put(10004, "执行指令失败");
        put(10005, "微信启动失败");
        put(10006, "指令正在执行");
        put(10007, "状态未知");
        put(10008, "指令参数不足");

        // WECHAT
        put(20001, "操作太频繁");
        put(20002, "邀请过期");
        put(20003, "群违规");
        put(20004, "未实名");
        put(20005, "已添加过");
        put(20006, "卡片不能点击");
        put(20007, "不允许通过群添加好友");
        put(20008, "用户搜索不到");
        put(20009, "被转发过");
        put(20010, "群人数超限");
        put(20011, "群违规,限制添加好友");
        put(20012, "对方帐号异党");
        put(20013, "指定消息不是图片");
        put(20014, "图片中没有二维码");
        put(20015, "不是个人名片你");

        put(20017, "未找到联系人");
        put(20018, "没有找到需要转发的消息");

        put(20022, "打开群详情失败");
        put(20023, "需要群主验证");

        put(32005, "指令超时");
        put(34002, "群卡片过期");
        put(34003, "[后台]该群已加过");
        put(34004, "[后台]评分判断操作频繁");
        put(34005, "敏感词");
    }};

    public static String getErrTitle(Integer code){
        if(code==null) return "";
        String title = _err_title.get(code);
        return StrUtils.getNullStr(title);
    }
}
